package com.zxq.modbus.config;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Configuration;
import org.springframework.stereotype.Component;

import javax.annotation.PostConstruct;

@Configuration
@Component
public class ModbusConfig {

    @Value("${lock.timeout}")
    private int timeOut;

    @Value("${protocol.id}")
    private Long protocolId;



    static ModbusConfig modbusConfig = null;

    public static int getTimeOut() {
        return modbusConfig.timeOut;
    }

    public static Long getProtocolId() {return  modbusConfig.protocolId;}


    @PostConstruct
    public void initConfig() {
          modbusConfig = this;
    }

}
